﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZDSoft.QLMS.Web.Helpers;

namespace ZDSoft.QLMS.Web.Controllers
{
    public class ControllerBase : Controller
    {
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            string controllerName = filterContext.Controller.ToString();//获取当前访问的Controller名称
            if (AppHelper.LoginedUser == null)
            {
                Response.Redirect("~/Account/Logout", true);
            }
            else
            {
                //if (AppHelper.Privileges.Where(o => o.ClassName.Contains(controllerName)).Count() > 0)
                //{
                    //当前登录的用户有访问当前Controller的权限
                    //do somethine
                    //base.OnActionExecuting(filterContext);
                //}
                //else
                //{
                    //跳转到其它页面（提示没有访问权限）
                    //Response.Redirect("~/Error.htm");
                //}
                base.OnActionExecuting(filterContext);
            }
        }

    }
}
